home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / codes.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-30  |  4.0 KB  |  106 lines

  1. /*
  2.     GWAda Development Environment for 386/486 PCs   
  3.     Copyright (C) 1993, Arthur Vargas Lopes  & Michael Bliss Feldman
  4.                         vlopes@vortex.ufrgs.br mfeldman@seas.gwu.edu
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; version 2 of the License.    
  9.  
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. /*  Codes.c  */
  22.  
  23. #include "externs.h"
  24.  
  25. void AVL_BUILD_CODES()
  26. {
  27.         short i, j, k = 0;
  28.         /*  Mount Table  */
  29.         for(i = 0; i < 8; ++i)
  30.                 for(j = 0; j < 40; ++j)  {
  31.                         avl_mat_code[i][j] = ' ';
  32.                         if (k < 157)
  33.                                 avl_mat_code[i][++j] =  avl_codes[k++];
  34.                         else
  35.                                 avl_mat_code[i][++j] = ' ';
  36.                         }
  37. }
  38.  
  39.  
  40. void AVL_SHOW_CODES()
  41. {
  42.         short i, j, k = 0, co;
  43.         char line[41];
  44.         sprintf(line,"%40s"," ");
  45.         co = _settextcolor(avl_men_letter);
  46.         for(i = 0; i < 8; ++i)  {
  47.                 _settextposition(i + 1 , 1);
  48.                 _outtext(line);
  49.                 }
  50.         for(i = 0; i < 8; ++i)  {
  51.                 for(j = 0; j < 40; ++j)
  52.                         line[j] = avl_mat_code[i][j];
  53.                 line[40] = '\0';
  54.                 _settextposition(i+1,1);
  55.                 _outmem(line,40);
  56.                 }
  57.         _settextposition(avl_codes_row+1,avl_codes_col*2+1);
  58.         sprintf(line,"%c",16);
  59.         _settextcolor(4);
  60.         _outtext(line);
  61.         _settextcolor(co);
  62. }
  63.  
  64.  
  65. void AVL_INSERT_CODES()
  66. {
  67.         AVL_WIN_PTR w;
  68.         int ch;
  69.         AVL_BUILD_CODES();
  70.         w = AVL_MAKE_WINDOW(" Special Characters ",3,30,12,72,avl_men_bk_color,avl_wnd_color);
  71.         while ( 1 )  {
  72.                 AVL_SHOW_CODES();
  73.                 ch = getch();
  74.                 switch ( ch ) {
  75.                         case 27 : 
  76.                                 AVL_DEL_WINDOW(w);
  77.                                 return;
  78.                         case 13 :
  79.                                 AVL_DEL_WINDOW(w);
  80.                                 AVL_EDIT_INSERT(avl_mat_code[avl_codes_row][avl_codes_col*2+1]);
  81.                                 return;
  82.                         case  0   :
  83.                         case 0xE0 : {
  84.                                 ch = getch();
  85.                                 switch(ch)  {
  86.                                        case 72 : /* Up  */ 
  87.                                                 if (--avl_codes_row < 0) avl_codes_row = 7;
  88.                                                 break;
  89.                                        case 80 : /* Down */ 
  90.                                                 if (++avl_codes_row > 7) avl_codes_row = 0;
  91.                                                 break;
  92.                                        case 75 : /* Left */ 
  93.                                                 if (--avl_codes_col < 0) avl_codes_col = 19;
  94.                                                 break;
  95.                                        case 77 : /* Right */ 
  96.                                                 if (++avl_codes_col > 19) avl_codes_col = 0;
  97.                                                 break;
  98.                                        default : putch(7); break;
  99.                                        }
  100.                                 continue;
  101.                                 }
  102.                         default : putch(7); break;
  103.                         }
  104.                 }
  105. }
  106.  
  107.